package com.lmiot.xyclick.Fragment;

import android.app.Dialog;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.lmiot.xyclick.Util.SpFlag;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.google.gson.Gson;
import com.lmiot.xyclick.AD.SDK.ADSDK;
import com.lmiot.xyclick.Activity.LoginActivity;
import com.lmiot.xyclick.Activity.PayVIPActivity;
import com.lmiot.xyclick.Activity.PermissionActivity;
import com.lmiot.xyclick.Activity.WebViewActivity;
import com.lmiot.xyclick.Activity.WxGonActivity;
import com.lmiot.xyclick.App.MyApp;
import com.lmiot.xyclick.Bean.QQBean;
import com.lmiot.xyclick.Bean.ZxingBean;
import com.lkx.liandianqinew.R;
import com.lmiot.xyclick.Util.ClickUtils;
import com.lmiot.xyclick.Util.Constants;
import com.lmiot.xyclick.Util.DataUtil;
import com.lmiot.xyclick.Util.EditDialogUtil;
import com.lmiot.xyclick.Util.FileUtils;
import com.lmiot.xyclick.Util.HttpUtilNew;
import com.lmiot.xyclick.Util.ImgUtil;
import com.lmiot.xyclick.Util.LayoutDialogUtil;
import com.lmiot.xyclick.Util.LogUtil;
import com.lmiot.xyclick.Util.PhoneUtil;
import com.lmiot.xyclick.Util.RandomUtil;
import com.lmiot.xyclick.inteface.OnBasicListener;
import com.uuzuche.lib_zxing.activity.CodeUtils;
import com.xiaoyi.intentsdklibrary.Utils.ArrayGson;
import com.youyi.yychosesdk.SDK.YYChoseSDK;
import com.youyi.yychosesdk.models.album.entity.Photo;
import com.youyi.yycutsdklibrary.SDK.YYCutSDK;
import com.youyi.yypermissionlibrary.SDK.OnPerListener;
import com.youyi.yypermissionlibrary.SDK.YYPerUtils;
import com.youyi.yyviewsdklibrary.Dialog.util.ToastUtil;
import com.youyi.yyviewsdklibrary.View.TitleBarView;
import com.youyi.yyviewsdklibrary.View.roundedimageview.RoundedImageView;
import com.zhy.http.okhttp.OkHttpUtils;
import com.zhy.http.okhttp.builder.GetBuilder;
import com.zhy.http.okhttp.callback.FileCallBack;
import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import okhttp3.Call;

public class SettingFragment extends Fragment implements View.OnClickListener {
    private static final String TAG = "SettingFragment";
    LinearLayout mBtLogout;
    LinearLayout mBtOpenVip;
    private Context mContext;
    private Dialog mDialog;
    private String mFilePath;
    private Handler mHandler;
    TextView mIdBtExit;
    LinearLayout mIdBtGon;
    LinearLayout mIdBtMore;
    LinearLayout mIdBtQuetion;
    LinearLayout mIdBtShare;
    LinearLayout mIdBtUpdate;
    LinearLayout mIdBtUs;
    LinearLayout mIdBtZfb;
    LinearLayout mIdHideLayout;
    LinearLayout mIdLoginLayout;
    TextView mIdNickname;
    TextView mIdOffTime;
    ImageView mIdPack;
    LinearLayout mIdPermission;
    LinearLayout mIdPrivate;
    LinearLayout mIdServer;
    View mIdServerLine;
    TextView mIdServerText;
    TitleBarView mIdTitleBar;
    LinearLayout mIdUserLayout;
    TextView mIdUserid;
    ImageView mIdUseridCopy;
    TextView mIdVersion;
    View mIdVipLine;
    ImageView mIdVipNo;
    ImageView mIdVipYse;
    ImageView mIdZxing;
    RoundedImageView mImgUserLogo;
    private FileInputStream mInputStream;
    private Intent mIntent;
    private List<QQBean> mQqBeanArrayList;
    private String mXYClickIMG;

    public SettingFragment() {
    }

    public SettingFragment(Context context) {
        this.mContext = context;
    }

    @Override // android.support.v4.app.Fragment
    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        View inflate = layoutInflater.inflate(R.layout.fragment_setting, (ViewGroup) null);
        this.mIdLoginLayout = (LinearLayout) inflate.findViewById(R.id.id_login_layout);
        this.mIdTitleBar = (TitleBarView) inflate.findViewById(R.id.id_title_bar);
        this.mImgUserLogo = (RoundedImageView) inflate.findViewById(R.id.img_user_logo);
        this.mIdNickname = (TextView) inflate.findViewById(R.id.id_nickname);
        this.mIdUserid = (TextView) inflate.findViewById(R.id.id_userid);
        this.mIdUseridCopy = (ImageView) inflate.findViewById(R.id.id_userid_copy);
        this.mIdOffTime = (TextView) inflate.findViewById(R.id.id_off_time);
        this.mIdZxing = (ImageView) inflate.findViewById(R.id.id_zxing);
        this.mIdVipYse = (ImageView) inflate.findViewById(R.id.id_vip_yse);
        this.mIdVipNo = (ImageView) inflate.findViewById(R.id.id_vip_no);
        this.mIdUserLayout = (LinearLayout) inflate.findViewById(R.id.id_user_layout);
        this.mBtOpenVip = (LinearLayout) inflate.findViewById(R.id.bt_open_vip);
        this.mIdBtMore = (LinearLayout) inflate.findViewById(R.id.id_bt_more);
        this.mIdVipLine = inflate.findViewById(R.id.id_vip_line);
        this.mIdPack = (ImageView) inflate.findViewById(R.id.id_pack);
        this.mIdBtZfb = (LinearLayout) inflate.findViewById(R.id.id_bt_zfb);
        this.mIdHideLayout = (LinearLayout) inflate.findViewById(R.id.id_hide_layout);
        this.mIdBtQuetion = (LinearLayout) inflate.findViewById(R.id.id_bt_quetion);
        this.mIdBtUs = (LinearLayout) inflate.findViewById(R.id.id_bt_us);
        this.mIdBtGon = (LinearLayout) inflate.findViewById(R.id.id_bt_gon);
        this.mIdBtShare = (LinearLayout) inflate.findViewById(R.id.id_bt_share);
        this.mIdVersion = (TextView) inflate.findViewById(R.id.id_version);
        this.mIdBtUpdate = (LinearLayout) inflate.findViewById(R.id.id_bt_update);
        this.mIdPermission = (LinearLayout) inflate.findViewById(R.id.id_permission);
        this.mIdServerText = (TextView) inflate.findViewById(R.id.id_server_text);
        this.mIdServer = (LinearLayout) inflate.findViewById(R.id.id_server);
        this.mIdServerLine = inflate.findViewById(R.id.id_server_line);
        this.mIdPrivate = (LinearLayout) inflate.findViewById(R.id.id_private);
        this.mBtLogout = (LinearLayout) inflate.findViewById(R.id.bt_logout);
        this.mIdBtExit = (TextView) inflate.findViewById(R.id.id_bt_exit);
        this.mIdLoginLayout.setOnClickListener(this);
        this.mImgUserLogo.setOnClickListener(this);
        this.mIdNickname.setOnClickListener(this);
        this.mIdUseridCopy.setOnClickListener(this);
        this.mIdZxing.setOnClickListener(this);
        this.mIdVipYse.setOnClickListener(this);
        this.mIdVipNo.setOnClickListener(this);
        this.mBtOpenVip.setOnClickListener(this);
        this.mIdBtMore.setOnClickListener(this);
        this.mIdBtZfb.setOnClickListener(this);
        this.mIdBtQuetion.setOnClickListener(this);
        this.mIdBtUs.setOnClickListener(this);
        this.mIdBtGon.setOnClickListener(this);
        this.mIdBtShare.setOnClickListener(this);
        this.mIdBtUpdate.setOnClickListener(this);
        this.mIdPermission.setOnClickListener(this);
        this.mIdServer.setOnClickListener(this);
        this.mIdPrivate.setOnClickListener(this);
        this.mBtLogout.setOnClickListener(this);
        this.mIdBtExit.setOnClickListener(this);
        this.mIdUserid.setOnLongClickListener(new View.OnLongClickListener() {
            /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass1 */

            public boolean onLongClick(View view) {
                ClickUtils.onlyVibrate(SettingFragment.this.mContext);
                ((ClipboardManager) SettingFragment.this.mContext.getSystemService(Context.CLIPBOARD_SERVICE)).setText(PhoneUtil.getIMEI(SettingFragment.this.mContext));
                ToastUtil.info(SettingFragment.this.getString(R.string.cp));
                return true;
            }
        });
        TextView textView = this.mIdVersion;
        textView.setText(getString(R.string.now_version) + getVersion());
        if (ADSDK.mIsGDT) {
            this.mBtOpenVip.setVisibility(View.GONE);
        } else if (DataUtil.getVip(MyApp.getContext())) {
            this.mBtOpenVip.setVisibility(View.GONE);
        } else {
            this.mBtOpenVip.setVisibility(View.VISIBLE);
        }
        setResetID();
        return inflate;
    }

    private void setResetID() {
        this.mIdBtExit.setOnLongClickListener(new View.OnLongClickListener() {
            /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass2 */

            public boolean onLongClick(View view) {
                if (DataUtil.getLoginByWx(MyApp.getContext())) {
                    ToastUtil.warning("当前为微信登录，不允许重置ID！");
                    return true;
                }
                LayoutDialogUtil.showSureDialog(SettingFragment.this.mContext, "重置用户ID", "重置ID将导致VIP失效，您是否要重置ID？", true, true, "点错了", "确定重置", new LayoutDialogUtil.OnResultClickListener() {
                    /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass2.AnonymousClass1 */

                    @Override // com.lmiot.xyclick.Util.LayoutDialogUtil.OnResultClickListener
                    public void result(boolean z) {
                        if (z) {
                            String str = PhoneUtil.getIMEI(SettingFragment.this.mContext) + RandomUtil.getRandomNum(10, 100);
                            LogUtil.d(SettingFragment.TAG, "新ID" + str);
                            FileUtils.saveIDFile("xydata", str);
                            DataUtil.setUserID(MyApp.getContext(), str);
                            DataUtil.setVip(MyApp.getContext(), false);
                            DataUtil.setLocked(MyApp.getContext(), false);
                            DataUtil.setUserRetist(MyApp.getContext(), false);
                            new Handler().post(new Runnable() {
                                /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass2.AnonymousClass1.AnonymousClass1 */

                                public void run() {
                                    HttpUtilNew.getInstance().regist(new OnBasicListener() {
                                        /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass2.AnonymousClass1.AnonymousClass1.AnonymousClass1 */

                                        @Override // com.lmiot.xyclick.inteface.OnBasicListener
                                        public void result(boolean z, String str) {
                                            if (z) {
                                                LayoutDialogUtil.showSureDialog(SettingFragment.this.mContext, "温馨提示", "您的ID已经重置完成，请手动重启APP，谢谢～", true, true, "取消", "重启APP", new LayoutDialogUtil.OnResultClickListener() {
                                                    /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass2.AnonymousClass1.AnonymousClass1.AnonymousClass1.AnonymousClass1 */

                                                    @Override // com.lmiot.xyclick.Util.LayoutDialogUtil.OnResultClickListener
                                                    public void result(boolean z) {
                                                        if (z) {
                                                            MyApp.getInstance().exit();
                                                        }
                                                    }
                                                });
                                            } else {
                                                ToastUtil.err("重置失败，请检查网络!");
                                            }
                                        }
                                    });
                                }
                            });
                        }
                    }
                });
                return true;
            }
        });
    }

    @Override // android.support.v4.app.Fragment
    public void onResume() {
        super.onResume();
        LogUtil.d(TAG, "sessionID889999:" + DataUtil.getSessionID(MyApp.getContext()));
        if (!TextUtils.isEmpty(DataUtil.getSessionID(MyApp.getContext()))) {
            showUserInfo();
            refreshUserInfo();
            return;
        }
        this.mIdLoginLayout.setVisibility(View.VISIBLE);
        this.mIdUserLayout.setVisibility(View.GONE);
        this.mBtLogout.setVisibility(View.GONE);
    }

    private void refreshUserInfo() {
        HttpUtilNew.getInstance().findUserBean(new HttpUtilNew.OnUserBeanListener() {
            /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass3 */

            @Override // com.lmiot.xyclick.Util.HttpUtilNew.OnUserBeanListener
            public void result(boolean z) {
                try {
                    if (!SettingFragment.this.isVisible()) {
                        return;
                    }
                    if (z) {
                        SettingFragment.this.showUserInfo();
                        return;
                    }
                    SettingFragment.this.mIdLoginLayout.setVisibility(View.VISIBLE);
                    SettingFragment.this.mIdUserLayout.setVisibility(View.GONE);
                    SettingFragment.this.mBtLogout.setVisibility(View.GONE);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }, new HttpUtilNew.OnOffLine() {
            /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass4 */

            @Override // com.lmiot.xyclick.Util.HttpUtilNew.OnOffLine
            public void result(boolean z) {
                if (z) {
                    SettingFragment.this.mIdLoginLayout.setVisibility(View.VISIBLE);
                    SettingFragment.this.mIdUserLayout.setVisibility(View.GONE);
                    SettingFragment.this.mBtLogout.setVisibility(View.GONE);
                }
            }
        });
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void showUserInfo() {
        this.mIdLoginLayout.setVisibility(View.GONE);
        this.mIdUserLayout.setVisibility(View.VISIBLE);
        this.mBtLogout.setVisibility(View.VISIBLE);
        if (DataUtil.getVip(this.mContext)) {
            this.mIdVipYse.setVisibility(View.VISIBLE);
            this.mBtOpenVip.setVisibility(View.GONE);
            this.mIdVipNo.setVisibility(View.GONE);
            this.mIdBtMore.setVisibility(View.GONE);
            this.mIdVipLine.setVisibility(View.GONE);
            String offTime = DataUtil.getOffTime(MyApp.getContext());
            if (offTime.startsWith("21")) {
                this.mIdOffTime.setText("会员有效至：永久会员！");
            } else {
                TextView textView = this.mIdOffTime;
                textView.setText("会员有效至：" + offTime);
            }
            if (ADSDK.mIsGDT) {
                this.mIdOffTime.setVisibility(View.GONE);
            } else {
                this.mIdOffTime.setVisibility(View.VISIBLE);
            }
        } else {
            this.mIdVipYse.setVisibility(View.GONE);
            this.mBtOpenVip.setVisibility(View.VISIBLE);
            this.mIdVipNo.setVisibility(View.VISIBLE);
            this.mIdBtMore.setVisibility(View.VISIBLE);
            this.mIdVipLine.setVisibility(View.VISIBLE);
            this.mIdOffTime.setVisibility(View.VISIBLE);
            this.mIdOffTime.setText("非会员，请先开通会员！");
        }
        this.mIdUserid.setText(PhoneUtil.getIMEI(MyApp.getContext()));
        if (DataUtil.getLoginByWx(MyApp.getContext())) {
            TextView textView2 = this.mIdNickname;
            textView2.setText(DataUtil.getWxNickName(MyApp.getContext()) + DataUtil.getWxNum(MyApp.getContext()));
            Glide.with(this.mContext).load(DataUtil.getWxImg(MyApp.getContext())).into(this.mImgUserLogo);
            return;
        }
        this.mIdNickname.setText(PhoneUtil.getModel());
        showUserImg();
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void showUserImg() {
        boolean hasSD = YYPerUtils.hasSD();
        Integer valueOf = Integer.valueOf((int) R.drawable.icon);
        if (hasSD) {
            try {
                File file = new File(Environment.getExternalStorageDirectory() + "/XYClick/temp", PhoneUtil.getIMEI(this.mContext) + "userImg.jpg");
                if (file.exists()) {
                    Glide.with(this.mContext).load(file).apply(new RequestOptions().skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.NONE).fitCenter()).into(this.mImgUserLogo);
                    return;
                }
                Glide.with(this.mContext).load(valueOf).into(this.mImgUserLogo);
            } catch (Exception e) {
                e.printStackTrace();
            }
        } else {
            Glide.with(this.mContext).load(valueOf).into(this.mImgUserLogo);
        }
    }

    private void downQQFile() {
        File file = new File(Environment.getExternalStorageDirectory() + "/Android");
        if (!file.exists()) {
            file.mkdirs();
        }
        ((GetBuilder) OkHttpUtils.get().url("https://ai.xiaoyizhineng.com:441/download/HelpVideo/autoclick/qqlist.txt")).build().execute(new FileCallBack(file.getAbsolutePath(), "qls.qll") {
            @Override
            public void onError(Call call, Exception e, int id) {
                ToastUtil.err("请先打开手机网络！");
            }

            @Override
            public void onResponse(File response, int id) {
                if (file != null) {
                    String readFileToString = FileUtils.readFileToString(file);
                    SettingFragment.this.mQqBeanArrayList = new ArrayGson().fromJsonList(readFileToString, QQBean.class);
                    if (SettingFragment.this.mQqBeanArrayList != null) {
                        SettingFragment.sortList(SettingFragment.this.mQqBeanArrayList);
                        ArrayList arrayList = new ArrayList();
                        for (QQBean qQBean : SettingFragment.this.mQqBeanArrayList) {
                            if (qQBean.isEnable()) {
                                arrayList.add(new EditDialogUtil.MenuBean(R.drawable.qq, qQBean.getName(), null));
                            } else {
                                arrayList.add(new EditDialogUtil.MenuBean(R.drawable.qq, qQBean.getName() + "(已满)", null));
                            }
                        }
                        EditDialogUtil.getInstance().buttomMenuDialog(SettingFragment.this.mContext, 4, arrayList, new EditDialogUtil.OnMenuClickListener() {
                            /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass5.AnonymousClass1 */

                            @Override // com.lmiot.xyclick.Util.EditDialogUtil.OnMenuClickListener
                            public void click(int i) {
                                SettingFragment.this.joinQQGroup01(((QQBean) SettingFragment.this.mQqBeanArrayList.get(i)).getValue());
                            }
                        }, true, false);
                        return;
                    }
                    return;
                }
                ToastUtil.err("请先打开手机网络！");
            }
        });
    }

    /* access modifiers changed from: private */
    public static void sortList(List<QQBean> list) {
        Collections.sort(list, new Comparator<QQBean>() {
            /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass6 */

            public int compare(QQBean qQBean, QQBean qQBean2) {
                if (qQBean.getLeve1() > qQBean2.getLeve1()) {
                    return 1;
                }
                return qQBean.getLeve1() == qQBean2.getLeve1() ? 0 : -1;
            }
        });
    }

    private void questionMethod() {
        ArrayList arrayList = new ArrayList();
        arrayList.add(new EditDialogUtil.MenuBean(R.drawable.qq, "QQ联系", null));
        arrayList.add(new EditDialogUtil.MenuBean(R.drawable.email, "发送邮件", null));
        EditDialogUtil.getInstance().buttomMenuDialog(this.mContext, 4, arrayList, new EditDialogUtil.OnMenuClickListener() {
            /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass7 */

            @Override // com.lmiot.xyclick.Util.EditDialogUtil.OnMenuClickListener
            public void click(int i) {
                if (i == 0) {
                    SettingFragment.this.jumpQQ();
                } else if (i == 1) {
                    SettingFragment.this.sendMail();
                }
            }
        }, false, false);
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void jumpQQ() {
        if (isQQClientAvailable(this.mContext)) {
            startActivity(new Intent("android.intent.action.VIEW", Uri.parse("mqqwpa://im/chat?chat_type=wpa&uin=809202631&version=1")));
        } else {
            ToastUtil.warning("请安装QQ客户端");
        }
    }

    public static boolean isQQClientAvailable(Context context) {
        List<PackageInfo> installedPackages = context.getPackageManager().getInstalledPackages(0);
        if (installedPackages != null) {
            for (int i = 0; i < installedPackages.size(); i++) {
                if (installedPackages.get(i).packageName.equals("com.tencent.mobileqq")) {
                    return true;
                }
            }
        }
        return false;
    }

    private void showZxingDialog() {
        Dialog dialog = this.mDialog;
        if (dialog != null) {
            dialog.dismiss();
        }
        Dialog createDailog = LayoutDialogUtil.createDailog(this.mContext, R.layout.dialog_user_zxing);
        this.mDialog = createDailog;
        ImageView imageView = (ImageView) createDailog.findViewById(R.id.id_img);
        final RelativeLayout relativeLayout = (RelativeLayout) this.mDialog.findViewById(R.id.id_code_layout);
        TextView textView = (TextView) this.mDialog.findViewById(R.id.tv_sure);
        TextView textView2 = (TextView) this.mDialog.findViewById(R.id.tv_cancel);
        ZxingBean zxingBean = new ZxingBean();
        zxingBean.setType(Constants.ZXING_TYPE_USER);
        zxingBean.setUserBrand(PhoneUtil.getBrand());
        zxingBean.setUserModel(PhoneUtil.getModel());
        zxingBean.setUserID(PhoneUtil.getIMEI(MyApp.getContext()));
        Bitmap createImage = CodeUtils.createImage(new Gson().toJson(zxingBean), 500, 500, BitmapFactory.decodeResource(getResources(), R.drawable.icon));
        if (createImage != null) {
            imageView.setImageBitmap(createImage);
        }
        textView.setOnClickListener(new View.OnClickListener() {
            /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass8 */

            public void onClick(View view) {
                Bitmap viewToBitmap = ImgUtil.viewToBitmap(relativeLayout);
                SettingFragment settingFragment = SettingFragment.this;
                settingFragment.mXYClickIMG = ImgUtil.saveBitmpToFile(viewToBitmap, PhoneUtil.getIMEI(SettingFragment.this.mContext) + "ZxingCode");
                LogUtil.d(SettingFragment.TAG, SettingFragment.this.mXYClickIMG);
                if (TextUtils.isEmpty(SettingFragment.this.mXYClickIMG)) {
                    ToastUtil.err("分享失败！");
                } else {
                    Uri fromFile = Uri.fromFile(new File(SettingFragment.this.mXYClickIMG));
                    Intent intent = new Intent();
                    intent.setAction("android.intent.action.SEND");
                    intent.putExtra("android.intent.extra.STREAM", fromFile);
                    intent.setType("image/*");
                    SettingFragment.this.startActivity(Intent.createChooser(intent, "分享图片"));
                }
                SettingFragment.this.mDialog.dismiss();
            }
        });
        textView2.setOnClickListener(new View.OnClickListener() {
            /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass9 */

            public void onClick(View view) {
                SettingFragment.this.mDialog.dismiss();
            }
        });
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void sendMail() {
        try {
            String str = DataUtil.getVip(MyApp.getContext()) ? "V" : "";
            Intent intent = new Intent("android.intent.action.SENDTO");
            intent.setData(Uri.parse("mailto:809202631@qq.com"));
            intent.putExtra("android.intent.extra.SUBJECT", getString(R.string.bmd) + getVersion());
            intent.putExtra("android.intent.extra.TEXT", getString(R.string.pbb) + PhoneUtil.getBrand() + "\n" + getString(R.string.pdn) + PhoneUtil.getModel() + "\n【手机版本】: Android" + PhoneUtil.getSystemVersion() + str + "\n【用户信息】:" + PhoneUtil.getIMEI(MyApp.getContext()) + "\n" + getString(R.string.qsn));
            startActivity(intent);
        } catch (Exception e) {
            ToastUtil.warning(getString(R.string.pnsp));
            e.printStackTrace();
        }
    }

    private void openZfbZxing() {
        try {
            Intent launchIntentForPackage = this.mContext.getPackageManager().getLaunchIntentForPackage("com.eg.android.AlipayGphone");
            launchIntentForPackage.addFlags(335544320);
            startActivity(launchIntentForPackage);
        } catch (Exception unused) {
            ToastUtil.warning(getString(R.string.not_zfb));
        }
    }

    private void ShareApk() {
        Intent intent = new Intent();
        intent.setAction("android.intent.action.SEND");
        intent.putExtra("android.intent.extra.TEXT", "https://sj.qq.com/myapp/detail.htm?apkName=" + this.mContext.getPackageName());
        intent.setType("text/plain");
        startActivity(Intent.createChooser(intent, getString(R.string.share_to)));
    }

    private void ShowDialogGon() {
        Dialog dialog = this.mDialog;
        if (dialog != null) {
            dialog.dismiss();
        }
        Dialog createDailog = LayoutDialogUtil.createDailog(this.mContext, R.layout.dialog_gon_layout);
        this.mDialog = createDailog;
        ((TextView) createDailog.findViewById(R.id.id_cancel)).setOnClickListener(new View.OnClickListener() {
            /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass10 */

            public void onClick(View view) {
                SettingFragment.this.mDialog.dismiss();
            }
        });
        ((TextView) this.mDialog.findViewById(R.id.id_sure)).setOnClickListener(new View.OnClickListener() {
            /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass11 */

            public void onClick(View view) {
                SettingFragment.this.mDialog.dismiss();
            }
        });
    }

    private String getVersion() {
        try {
            return this.mContext.getPackageManager().getPackageInfo(this.mContext.getPackageName(), 0).versionName;
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }
    }

    @Override // android.support.v4.app.Fragment
    public void onDestroyView() {
        super.onDestroyView();
    }

    public boolean joinQQGroup01(String str) {
        if (DataUtil.getVip(this.mContext)) {
            ClickUtils.onlyVibrate(this.mContext);
            ((ClipboardManager) this.mContext.getSystemService(Context.CLIPBOARD_SERVICE)).setText(PhoneUtil.getIMEI(this.mContext));
            ToastUtil.info(getString(R.string.cp));
        }
        Intent intent = new Intent();
        intent.setData(Uri.parse("mqqopensdkapi://bizAgent/qm/qr?url=http%3A%2F%2Fqm.qq.com%2Fcgi-bin%2Fqm%2Fqr%3Ffrom%3Dapp%26p%3Dandroid%26k%3D" + str));
        try {
            startActivity(intent);
            return true;
        } catch (Exception unused) {
            ToastUtil.warning("未安装手Q或安装的版本不支持!");
            return false;
        }
    }

    private void showQQ() {
        ArrayList arrayList = new ArrayList();
        arrayList.add(new EditDialogUtil.MenuBean(R.drawable.qq, "交流2群", null));
        arrayList.add(new EditDialogUtil.MenuBean(R.drawable.qq, "交流1群", null));
        EditDialogUtil.getInstance().buttomMenuDialog(this.mContext, 4, arrayList, new EditDialogUtil.OnMenuClickListener() {
            /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass12 */

            @Override // com.lmiot.xyclick.Util.EditDialogUtil.OnMenuClickListener
            public void click(int i) {
                if (i == 0) {
                    SettingFragment.this.joinQQGroup01("HFYzD0YV-NlNoOp3WPj3rNXND892VzH9");
                } else if (i == 1) {
                    SettingFragment.this.joinQQGroup01("UbfW4LNtQmhWq5WQ1WPokK3qLr3XXTfS");
                }
            }
        }, true, false);
    }

    private void setUserImg() {
        ArrayList arrayList = new ArrayList();
        arrayList.add(new EditDialogUtil.MenuBean(R.drawable.chose_pic, "选择相册", null));
        arrayList.add(new EditDialogUtil.MenuBean(R.drawable.chose_camera, "前往拍照", null));
        EditDialogUtil.getInstance().buttomMenuDialog(this.mContext, 4, arrayList, new EditDialogUtil.OnMenuClickListener() {
            /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass13 */

            @Override // com.lmiot.xyclick.Util.EditDialogUtil.OnMenuClickListener
            public void click(int i) {
                if (i == 0) {
                    YYPerUtils.sd(SettingFragment.this.mContext, "选择相册需要申请存储权限哦", new OnPerListener() {
                        /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass13.AnonymousClass1 */

                        @Override // com.youyi.yypermissionlibrary.SDK.OnPerListener
                        public void result(boolean z, String str) {
                            if (z) {
                                YYChoseSDK.getInstance(SettingFragment.this.mContext).chosePic(false, 1, new YYChoseSDK.OnSelectListener() {
                                    /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass13.AnonymousClass1.AnonymousClass1 */

                                    @Override // com.youyi.yychosesdk.SDK.YYChoseSDK.OnSelectListener
                                    public void onCancel() {
                                    }

                                    @Override // com.youyi.yychosesdk.SDK.YYChoseSDK.OnSelectListener
                                    public void onResult(ArrayList<Photo> arrayList, boolean z) {
                                        YYCutSDK.getInstance(SettingFragment.this.mContext).cut(arrayList.get(0).path, true, YYCutSDK.CutShape.Oval, new YYCutSDK.OnYYCutListener() {
                                            /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass13.AnonymousClass1.AnonymousClass1.AnonymousClass1 */

                                            @Override // com.youyi.yycutsdklibrary.SDK.YYCutSDK.OnYYCutListener
                                            public void result(boolean z, String str, Bitmap bitmap) {
                                                if (z) {
                                                    ImgUtil.saveBitmpToFile(bitmap, new File(Environment.getExternalStorageDirectory() + "/XYClick/temp", PhoneUtil.getIMEI(SettingFragment.this.mContext) + "userImg.jpg"));
                                                    SettingFragment.this.showUserImg();
                                                }
                                            }
                                        });
                                    }
                                });
                            }
                        }
                    });
                } else if (i == 1) {
                    YYPerUtils.camera(SettingFragment.this.mContext, "选择拍照需要申请相机权限哦", new OnPerListener() {
                        /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass13.AnonymousClass2 */

                        @Override // com.youyi.yypermissionlibrary.SDK.OnPerListener
                        public void result(boolean z, String str) {
                            if (z) {
                                YYChoseSDK.getInstance(SettingFragment.this.mContext).camera(new YYChoseSDK.OnSelectListener() {
                                    /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass13.AnonymousClass2.AnonymousClass1 */

                                    @Override // com.youyi.yychosesdk.SDK.YYChoseSDK.OnSelectListener
                                    public void onCancel() {
                                    }

                                    @Override // com.youyi.yychosesdk.SDK.YYChoseSDK.OnSelectListener
                                    public void onResult(ArrayList<Photo> arrayList, boolean z) {
                                        YYCutSDK.getInstance(SettingFragment.this.mContext).cut(arrayList.get(0).path, true, YYCutSDK.CutShape.Oval, new YYCutSDK.OnYYCutListener() {
                                            /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass13.AnonymousClass2.AnonymousClass1.AnonymousClass1 */

                                            @Override // com.youyi.yycutsdklibrary.SDK.YYCutSDK.OnYYCutListener
                                            public void result(boolean z, String str, final Bitmap bitmap) {
                                                if (z) {
                                                    YYPerUtils.sd(SettingFragment.this.mContext, "保存头像需要申请存储权限哦", new OnPerListener() {
                                                        /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass13.AnonymousClass2.AnonymousClass1.AnonymousClass1.AnonymousClass1 */

                                                        @Override // com.youyi.yypermissionlibrary.SDK.OnPerListener
                                                        public void result(boolean z, String str) {
                                                            if (z) {
                                                                ImgUtil.saveBitmpToFile(bitmap, new File(Environment.getExternalStorageDirectory() + "/XYClick/temp", PhoneUtil.getIMEI(SettingFragment.this.mContext) + "userImg.jpg"));
                                                                SettingFragment.this.showUserImg();
                                                            }
                                                        }
                                                    });
                                                }
                                            }
                                        });
                                    }
                                });
                            }
                        }
                    });
                }
            }
        }, false, false);
    }

    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.bt_logout /*{ENCODED_INT: 2131296332}*/:
                DataUtil.setVip(MyApp.getContext(), false);
                DataUtil.setSessionID(MyApp.getContext(), "");
                DataUtil.setWxID(MyApp.getContext(), "");
                DataUtil.setWxImg(MyApp.getContext(), "");
                DataUtil.setWxNickName(MyApp.getContext(), "");
                DataUtil.setOffTime(MyApp.getContext(), "");
                DataUtil.setLoginByWx(MyApp.getContext(), false);
                this.mIdLoginLayout.setVisibility(View.VISIBLE);
                this.mBtLogout.setVisibility(View.GONE);
                this.mIdUserLayout.setVisibility(View.GONE);
                return;
            case R.id.bt_open_vip /*{ENCODED_INT: 2131296334}*/:
                if (TextUtils.isEmpty(DataUtil.getSessionID(MyApp.getContext()))) {
                    Intent intent = new Intent(this.mContext, LoginActivity.class);
                    this.mIntent = intent;
                    startActivity(intent);
                    return;
                }
                Intent intent2 = new Intent(this.mContext, PayVIPActivity.class);
                this.mIntent = intent2;
                startActivity(intent2);
                return;
            case R.id.id_bt_exit /*{ENCODED_INT: 2131296514}*/:
                LayoutDialogUtil.showSureDialog(this.mContext, "温馨提示", "您是否要退出APP?", true, true, "取消", "确定", new LayoutDialogUtil.OnResultClickListener() {
                    /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass16 */

                    @Override // com.lmiot.xyclick.Util.LayoutDialogUtil.OnResultClickListener
                    public void result(boolean z) {
                        if (z) {
                            MyApp.getInstance().exit();
                        }
                    }
                });
                return;
            case R.id.id_bt_gon /*{ENCODED_INT: 2131296515}*/:
                Intent intent3 = new Intent(this.mContext, WxGonActivity.class);
                this.mIntent = intent3;
                startActivity(intent3);
                return;
            case R.id.id_bt_more /*{ENCODED_INT: 2131296516}*/:
            case R.id.id_vip_no /*{ENCODED_INT: 2131297004}*/:
                if (!ADSDK.mIsGDT) {
                    Intent intent4 = new Intent(this.mContext, PayVIPActivity.class);
                    this.mIntent = intent4;
                    startActivity(intent4);
                    return;
                }
                return;
            case R.id.id_bt_quetion /*{ENCODED_INT: 2131296518}*/:
                LayoutDialogUtil.showSureDialog(this.mContext, "温馨提示", "1.麻烦用文字简单描述您的问题;\n2.如果有截图或视频，麻烦添加到附件;\n\n注：如果无法自动拉起邮箱，或无法填充邮件地址，请手动发送到以下邮箱：\n809202631@qq.com\n", true, false, "取消", "发送邮件", new LayoutDialogUtil.OnResultClickListener() {
                    /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass15 */

                    @Override // com.lmiot.xyclick.Util.LayoutDialogUtil.OnResultClickListener
                    public void result(boolean z) {
                        if (z) {
                            SettingFragment.this.sendMail();
                        }
                    }
                });
                return;
            case R.id.id_bt_share /*{ENCODED_INT: 2131296519}*/:
                ShareApk();
                return;
            case R.id.id_bt_update /*{ENCODED_INT: 2131296520}*/:
                try {
                    Intent intent5 = new Intent("android.intent.action.VIEW", Uri.parse("market://details?id=" + this.mContext.getPackageName()));
                    intent5.addFlags(335544320);
                    startActivity(intent5);
                    return;
                } catch (Exception e) {
                    e.printStackTrace();
                    ToastUtil.err("搜索失败");
                    return;
                }
            case R.id.id_bt_us /*{ENCODED_INT: 2131296521}*/:
                downQQFile();
                return;
            case R.id.id_bt_zfb /*{ENCODED_INT: 2131296522}*/:
                ADSDK.getInstance().chosADShow(this.mContext, false, new ADSDK.OnADFinishListener() {
                    /* class com.lmiot.xyclick.Fragment.SettingFragment.AnonymousClass14 */

                    @Override // com.lmiot.xyclick.AD.SDK.ADSDK.OnADFinishListener
                    public void result(boolean z) {
                        ToastUtil.success("感谢支持！");
                    }
                });
                return;
            case R.id.id_login_layout /*{ENCODED_INT: 2131296759}*/:
                Intent intent6 = new Intent(this.mContext, LoginActivity.class);
                this.mIntent = intent6;
                startActivity(intent6);
                return;
            case R.id.id_permission /*{ENCODED_INT: 2131296827}*/:
                Intent intent7 = new Intent(this.mContext, PermissionActivity.class);
                this.mIntent = intent7;
                startActivity(intent7);
                return;
            case R.id.id_private /*{ENCODED_INT: 2131296847}*/:
                Intent intent8 = new Intent(this.mContext, WebViewActivity.class);
                this.mIntent = intent8;
                intent8.putExtra(SpFlag.k, "《隐私政策》");
                if (ADSDK.nowVersion.startsWith("HW")) {
                    this.mIntent.putExtra("url", "https://ai.xiaoyizhineng.com:441/download/HelpVideo/autoclick/privateh.html");
                } else {
                    this.mIntent.putExtra("url", "https://ai.xiaoyizhineng.com:441/download/HelpVideo/autoclick/private.html");
                }
                startActivity(this.mIntent);
                return;
            case R.id.id_server /*{ENCODED_INT: 2131296895}*/:
                Intent intent9 = new Intent(this.mContext, WebViewActivity.class);
                this.mIntent = intent9;
                intent9.putExtra(SpFlag.k, "《服务协议》");
                if (ADSDK.nowVersion.startsWith("HW")) {
                    this.mIntent.putExtra("url", "https://ai.xiaoyizhineng.com:441/download/HelpVideo/autoclick/serverh.html");
                } else {
                    this.mIntent.putExtra("url", "https://ai.xiaoyizhineng.com:441/download/HelpVideo/autoclick/server.html");
                }
                startActivity(this.mIntent);
                return;
            case R.id.id_userid_copy /*{ENCODED_INT: 2131296981}*/:
                ClickUtils.onlyVibrate(this.mContext);
                ((ClipboardManager) this.mContext.getSystemService(Context.CLIPBOARD_SERVICE)).setText(PhoneUtil.getIMEI(this.mContext));
                ToastUtil.success(getString(R.string.cp));
                return;
            case R.id.id_vip_yse /*{ENCODED_INT: 2131297005}*/:
                ToastUtil.warning(getString(R.string.ivip1));
                return;
            case R.id.id_zxing /*{ENCODED_INT: 2131297020}*/:
                ClickUtils.onlyVibrate(this.mContext);
                showZxingDialog();
                return;
            case R.id.img_user_logo /*{ENCODED_INT: 2131297029}*/:
                if (!DataUtil.getLoginByWx(MyApp.getContext())) {
                    setUserImg();
                    return;
                } else {
                    ToastUtil.warning("微信登录下不可设置头像");
                    return;
                }
            default:
                return;
        }
    }
}
